import { createRouter, createWebHistory,createWebHashHistory } from 'vue-router'

// @ts-ignore
//import HomeView from "@/views/HomeView.vue"

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: () => import('@/views/HomeView.vue')
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      // @ts-ignore
      component: () => import('@/views/AboutView.vue')
    }
    ,
    {
      path: '/fz',
      name: 'prtsCalculator',
      meta:{
        title: '招募计算器'//title配置
      },
      component: () => import('@/views/PrtsCalculatorView.vue')
    }
  ]
})

router.afterEach((to) => {
  if (to.meta.title) {
    document.title = to.meta.title as string
  }
  // else {
  //   document.title = '网易云音乐'
  // }
})

export default router
